
Page({
  data:{
    prograss:[],
    done:[],
    value:"",
  },
  onLoad(){
    
  },
  submit(e){
    var value = e.detail.value;
    var prograss = this.data.prograss;
    prograss.unshift(value);
    this.setData({prograss,value:""})
  },
  toDone(e){
    var value = e.currentTarget.dataset.value;
    var prograss = this.data.prograss;
    var done = this.data.done;
    var index = prograss.indexOf(value);
    var del = prograss.splice(index,1);
    done.unshift(...del);
    this.setData({prograss,done})
  },
  delete(e){
    var value = e.currentTarget.dataset.value;
    var prograss = this.data.prograss;
    var done = this.data.done;
    if(prograss.includes(value)){
      var index = prograss.indexOf(value);
      prograss.splice(index,1)
    }else if(done.includes(value)){
      var index = done.indexOf(value);
      done.splice(index,1)
    }
    this.setData({
      prograss,
      done
    })
  },
  toPrograss(e){
    var value = e.currentTarget.dataset.value;
    var prograss = this.data.prograss;
    var done = this.data.done;
    var index = done.indexOf(value);
    var del = done.splice(index,1);
    prograss.push(...del);
    this.setData({prograss,done})
  }
})
